package com.qt.collection.myset;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

public class CollectionsDemo01 {

    public static void main(String[] args) {

        ArrayList<String> strlist = new ArrayList<>();

        Collections.addAll(strlist,"1","2","3","4","5");
        System.out.println(strlist);

        System.out.println("---------------------");
        Collections.shuffle(strlist);

        System.out.println(strlist);
        System.out.println("---------------------");

        Collections.sort(strlist, (o1, o2) -> Integer.valueOf(o1) - Integer.valueOf(o2));
        System.out.println(strlist);
        System.out.println("---------------------");
        //二分查找
        Collections.binarySearch(strlist, "2");

        ArrayList <String> newlist = new ArrayList<>();
        Collections.copy(strlist,newlist);

        newlist.add("6");
        System.out.println(strlist);




    }




}
